<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="../css/setting.css" />
</head>

<body class="white">
	<div class="mui-content login" id="vueMain">
		<div class="mui-content-padded">
			<!--<div class="back-icon mui-action-back"><img src="../icon/gray-back.png" class=" " alt="" /></div>-->
	    		<div class="logobox">
	    			<div class="logobsd">
	    				<div class="turu"></div>
	    				<div class="turu2"></div>
	    			</div>
	    		</div>
	    		<div class="forms">
			    	<div class="inputBox">
			    		<input type="number" name="" v-model="sendData.mobile" placeholder="您的手机号码" class="userIcon" />
			    	</div>
			    	<div class="inputBox">
			    		<input type="password" name="" v-model="sendData.password" placeholder="" class="pwdIcon2" />
			    	</div>
		    </div>
		    <div class="mui-content-padded" style="margin-top: 20px;">
		   		<button type="button" class="bexta-btn bexta-btn-red mui-btn mui-btn-block " id="loginBtn"  >登录</button>
		   </div>
		   <div class="mui-clearfix nb" style="padding:0 10px;">
		   		<div class="mui-pull-right link" _id="forget" _title="忘记密码" _href="forget.html" _extras="type=forget">忘记密码</div>
		   		<!--<div class="mui-pull-left link" _id="register" _title="注册" _href="register.html">注册</div>-->
		   </div>
	    </div>
	</div>
<script src="../js/mui.js"></script>
<script src="../js/vue.min.js"></script>
<script src="../js/bexta.js"></script>
<script type="text/javascript">
	var apps;
	mui.init();
	 mui.ready(function () {
	 	  document.querySelector('.login').style.paddingTop = bexta.getStatusHeight() + 'px';
	 	  document.querySelector('.turu').classList.add('active');
	 });
	mui.plusReady(function () {
//		plus.navigator.setStatusBarBackground( '#FFFFFF' ); //背景
//		plus.navigator.setStatusBarStyle( 'UIStatusBarStyleBlackOpaque' );  //字体
	    initVue();
	});
	function initVue(){
		apps = new Vue({
			el:'#vueMain',
			data:{
				sendData:{
					mobile:'',
					password:''
				}
			},
			mounted:function(){
				initEvent();
			}
		});
	}
	function initEvent(){
		document.querySelector('#loginBtn').addEventListener('tap', function(){
			if( check.phone(apps.sendData.mobile) && apps.sendData.password.length > 5 && apps.sendData.password.length <= 16 ){
				bexta.ajax( api.login, function(res){
					bexta.setStorage(MERCHANT, res);
					console.log(111);
    						plus.webview.getWebviewById('index').evalJS('plus.webview.currentWebview().reload()');
					bexta.goWebview(function(){
	    					mui.fire(plus.webview.getLaunchWebview(), 'toggleClick', {
	    						path:'index'
	    					});
	    					plus.webview.getLaunchWebview().evalJS('plus.webview.currentWebview().reload()');
	    				});
//	    				mui.later(function(){
//  					},20);
//					mui.back();
				},{data:apps.sendData,showWaiting:true});
			}else{
				mui.toast("手机或密码错误");
			}
		});
	}
</script>
</body>
</html>